/**
 * 
 */
package name.yzhu.httpserver;

import java.util.ArrayList;
import java.util.List;

import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.handler.HandlerCollection;

/**
 * @author yhzhu
 *
 */
public class HttpHandleServer extends AbstractHttpServer {
	private List<Handler>handles = new ArrayList<Handler>();
	
	@Override
	protected void initialContexts() {
		HandlerCollection hc =new HandlerCollection();
		if (handles.size() > 0){
			for (Handler handler: handles)
				hc.addHandler(handler);
		}
		server.setHandler(hc);
	}

	public void addHandle(Handler handler) {
		handles.add(handler);
	}
	
	@Override
	protected ServerType getServerType() {
		return AbstractHttpServer.ServerType.Handle;
	}
}
